<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * User: krisbuist
 * Date: 1/19/12
 * Time: 10:21 PM
 */

/**
 * @param $permissions array
 * @param $controller string
 * @param $action string
 * @param $accessLevel
 * @return bool
 */
if (!function_exists('isAuthorized')) {
    function isAuthorized($permissions, $controller, $action, $accessLevel)
    {
        if(isset($permissions[$controller]) && isset($permissions[$controller][$action]))
        {
            return in_array($accessLevel, $permissions[$controller][$action]);
        }
        else
        {
            return true;
        }
    }
}